#include<stdio.h>
#include <string.h>
#include<netLib/client.h>
#include<netLib/server.h>

void testServer();
void testClient();
int main()
{
    setvbuf (stdout, NULL, _IONBF, 0);
    
#if 1
    testServer();
#else
    testClient();
#endif
    
    return 0;
}

void testServer()
{
    NetServer *server = new NetServer();
    if( server->init(1314) )
    {
        server->loop();
        server->disconnect();
    }
    else
    {
        printf("failed\n");
    }
}

void testClient()
{
    NetClient *client=new NetClient();
    client->init("127.0.0.1",1314);
    char *pp=new char[8888];
    memset(pp,'B',8888);
    pp[8887]=0;
    
    client->send(pp,8888);
    client->loop();
    client->disconnect();
    
    printf("ojbk\n");
}